namespace ext.data
{
	using System;
	using System.Runtime.CompilerServices;
	using System.Html;
	using System.Collections;
	
	
	/// <summary>
	/// Ext.data.DataWriter facilitates create, update, and destroy actions between
	/// an Ext.data.Store and a server-side framework. A Writer enabled Store will
	/// automatically manage the Ajax requests to perform CRUD actions on a Store.  Ext.data.DataWriter is an abstract base class which is intended to be extended
	/// and should not be created directly. For existing implementations, see
	/// {@link Ext.data.JsonWriter}.  Creating a writer is simple:  
	/// var writer = new Ext.data.JsonWriter({
	/// encode: false // &amp;lt;--- false causes data to be printed to jsonData config-property of Ext.Ajax#reqeust
	/// });
	///  Same old JsonReader as Ext-2.x:  
	/// var reader = new Ext.data.JsonReader({idProperty: &apos;id&apos;}, [{name: &apos;first&apos;}, {name: &apos;last&apos;}, {name: &apos;email&apos;}]);
	///  The proxy for a writer enabled store can be configured with a simple url:  
	/// // Create a standard HttpProxy instance.
	/// var proxy = new Ext.data.HttpProxy({
	/// url: &apos;app.php/users&apos; // &amp;lt;--- Supports &quot;provides&quot;-type urls, such as &apos;/users.json&apos;,...
	/// </summary>
	/// <htmlSummary>
	/// &lt;p&gt;Ext.data.DataWriter facilitates create, update, and destroy actions between
	/// an Ext.data.Store and a server-side framework. A Writer enabled Store will
	/// automatically manage the Ajax requests to perform CRUD actions on a Store.&lt;/p&gt;
	/// &lt;p&gt;Ext.data.DataWriter is an abstract base class which is intended to be extended
	/// and should not be created directly. For existing implementations, see
	/// {@link Ext.data.JsonWriter}.&lt;/p&gt;
	/// &lt;p&gt;Creating a writer is simple:&lt;/p&gt;
	/// &lt;pre&gt;&lt;code&gt;
	/// var writer = new Ext.data.JsonWriter({
	/// encode: false // &amp;lt;--- false causes data to be printed to jsonData config-property of Ext.Ajax#reqeust
	/// });
	/// &lt;/code&gt;&lt;/pre&gt;
	/// &lt;p&gt;Same old JsonReader as Ext-2.x:&lt;/p&gt;
	/// &lt;pre&gt;&lt;code&gt;
	/// var reader = new Ext.data.JsonReader({idProperty: &apos;id&apos;}, [{name: &apos;first&apos;}, {name: &apos;last&apos;}, {name: &apos;email&apos;}]);
	/// &lt;/code&gt;&lt;/pre&gt;
	///
	/// &lt;p&gt;The proxy for a writer enabled store can be configured with a simple &lt;code&gt;url&lt;/code&gt;:&lt;/p&gt;
	/// &lt;pre&gt;&lt;code&gt;
	/// // Create a standard HttpProxy instance.
	/// var proxy = new Ext.data.HttpProxy({
	/// url: &apos;app.php/users&apos; // &amp;lt;--- Supports &quot;provides&quot;-type urls, such as &apos;/users.json&apos;, &apos;/products.xml&apos; (Hello Rails/Merb)
	/// });
	/// &lt;/code&gt;&lt;/pre&gt;
	/// &lt;p&gt;For finer grained control, the proxy may also be configured with an &lt;code&gt;API&lt;/code&gt;:&lt;/p&gt;
	/// &lt;pre&gt;&lt;code&gt;
	/// // Maximum flexibility with the API-configuration
	/// var proxy = new Ext.data.HttpProxy({
	/// api: {
	/// read : &apos;app.php/users/read&apos;,
	/// create : &apos;app.php/users/create&apos;,
	/// update : &apos;app.php/users/update&apos;,
	/// destroy : { // &amp;lt;--- Supports object-syntax as well
	/// url: &apos;app.php/users/destroy&apos;,
	/// method: &quot;DELETE&quot;
	/// }
	/// }
	/// });
	/// &lt;/code&gt;&lt;/pre&gt;
	/// &lt;p&gt;Pulling it all together into a Writer-enabled Store:&lt;/p&gt;
	/// &lt;pre&gt;&lt;code&gt;
	/// var store = new Ext.data.Store({
	/// proxy: proxy,
	/// reader: reader,
	/// writer: writer,
	/// autoLoad: true,
	/// autoSave: true // -- Cell-level updates.
	/// });
	/// &lt;/code&gt;&lt;/pre&gt;
	/// &lt;p&gt;Initiating write-actions &lt;b&gt;automatically&lt;/b&gt;, using the existing Ext2.0 Store/Record API:&lt;/p&gt;
	/// &lt;pre&gt;&lt;code&gt;
	/// var rec = store.getAt(0);
	/// rec.set(&apos;email&apos;, &apos;foo@bar.com&apos;); // &amp;lt;--- Immediately initiates an UPDATE action through configured proxy.
	///
	/// store.remove(rec); // &amp;lt;---- Immediately initiates a DESTROY action through configured proxy.
	/// &lt;/code&gt;&lt;/pre&gt;
	/// &lt;p&gt;For &lt;b&gt;record/batch&lt;/b&gt; updates, use the Store-configuration {@link Ext.data.Store#autoSave autoSave:false}&lt;/p&gt;
	/// &lt;pre&gt;&lt;code&gt;
	/// var store = new Ext.data.Store({
	/// proxy: proxy,
	/// reader: reader,
	/// writer: writer,
	/// autoLoad: true,
	/// autoSave: false // -- disable cell-updates
	/// });
	///
	/// var urec = store.getAt(0);
	/// urec.set(&apos;email&apos;, &apos;foo@bar.com&apos;);
	///
	/// var drec = store.getAt(1);
	/// store.remove(drec);
	///
	/// // Push the button!
	/// store.save();
	/// &lt;/code&gt;&lt;/pre&gt;
	/// </htmlSummary>
	/// <definedin>src\data\DataWriter.js</definedin>
	[ScriptName("DataWriter")]
	[ScriptNamespace("Ext.data")]
	[Imported()]
	public partial class DataWriter
	{
		
		#region Constructors
		/// <summary>Constructor</summary>
		/// <param name="meta">Metadata configuration options (implementation-specific)</param>
		/// <param name="recordType">
		/// Either an Array of field definition objects as specified
		/// in {@link Ext.data.Record#create}, or an {@link Ext.data.Record} object created
		/// using {@link Ext.data.Record#create}.
		/// </param>
		public DataWriter(object meta, object recordType)
		{
		}
		
		public DataWriter(ext.data.DataWriter_Configuration config)
		{
		}
		
		/// <summary>Constructor</summary>
		public DataWriter()
		{
		}
		#endregion
		
		#region Fields
		/// <summary>
		/// false by default. Set true to have DataWriter return ALL fields of a modified
		/// record -- not just those that changed.
		/// false to have DataWriter only request modified fields from a record.
		/// </summary>
		/// <htmlSummary>
		/// &lt;tt&gt;false&lt;/tt&gt; by default. Set &lt;tt&gt;true&lt;/tt&gt; to have DataWriter return ALL fields of a modified
		/// record -- not just those that changed.
		/// &lt;tt&gt;false&lt;/tt&gt; to have DataWriter only request modified fields from a record.
		/// </htmlSummary>
		/// <definedin>src\data\DataWriter.js</definedin>
		[ScriptName("writeAllFields")]
		public bool WriteAllFields;
		
		/// <summary>
		/// false by default. Set true to have the DataWriter always write HTTP params as a list,
		/// even when acting upon a single record.
		/// </summary>
		/// <htmlSummary>
		/// &lt;tt&gt;false&lt;/tt&gt; by default. Set &lt;tt&gt;true&lt;/tt&gt; to have the DataWriter &lt;b&gt;always&lt;/b&gt; write HTTP params as a list,
		/// even when acting upon a single record.
		/// </htmlSummary>
		/// <definedin>src\data\DataWriter.js</definedin>
		[ScriptName("listful")]
		public bool Listful;
		
		/// <summary>
		/// Abstract method that should be implemented in all subclasses
		/// (e.g.: {@link Ext.data.JsonWriter#updateRecord JsonWriter.updateRecord}
		/// </summary>
		/// <definedin>src\data\DataWriter.js</definedin>
		[ScriptName("updateRecord")]
		public System.Delegate UpdateRecord;
		
		/// <summary>
		/// Abstract method that should be implemented in all subclasses
		/// (e.g.: {@link Ext.data.JsonWriter#createRecord JsonWriter.createRecord})
		/// </summary>
		/// <definedin>src\data\DataWriter.js</definedin>
		[ScriptName("createRecord")]
		public System.Delegate CreateRecord;
		
		/// <summary>
		/// Abstract method that should be implemented in all subclasses
		/// (e.g.: {@link Ext.data.JsonWriter#destroyRecord JsonWriter.destroyRecord})
		/// </summary>
		/// <definedin>src\data\DataWriter.js</definedin>
		[ScriptName("destroyRecord")]
		public System.Delegate DestroyRecord;
		#endregion
		
		#region Methods
		/// <summary>
		/// abstract method meant to be overridden by all DataWriter extensions. It&apos;s the extension&apos;s job to apply the &quot;data&quot; to the &quot;params&quot;.
		/// The data-object provided to render is populated with data according to the meta-info defined in the user&apos;s DataReader config,
		/// </summary>
		/// <definedin>src\data\DataWriter.js</definedin>
		/// <param name="action">[Ext.data.Api.actions.create|read|update|destroy]</param>
		/// <param name="rs">Store recordset</param>
		/// <param name="params">Http params to be sent to server.</param>
		/// <param name="data">object populated according to DataReader meta-data.</param>
		[ScriptName("render")]
		public void Render(string action, ext.data.RecordClass[] rs, object @params, object data)
		{
			throw new System.Exception("Imported - not implemented");
		}
		
		/// <summary>
		/// Converts a Record to a hash, taking into account the state of the Ext.data.Record along with configuration properties
		/// related to its rendering, such as {@link #writeAllFields}, {@link Ext.data.Record#phantom phantom}, {@link Ext.data.Record#getChanges getChanges} and
		/// {@link Ext.data.DataReader#idProperty idProperty}
		/// </summary>
		/// <definedin>src\data\DataWriter.js</definedin>
		/// <param name="rec">The Record from which to create a hash.</param>
		/// <param name="config">&lt;b&gt;NOT YET IMPLEMENTED&lt;/b&gt;. Will implement an exlude/only configuration for fine-control over which fields do/don&apos;t get rendered.</param>
		[ScriptName("toHash")]
		public object ToHash(ext.data.RecordClass rec, object config)
		{
			throw new System.Exception("Imported - not implemented");
		}
		
		/// <summary>
		/// Converts a {@link Ext.data.DataWriter#toHash Hashed} {@link Ext.data.Record} to fields-array array suitable
		/// for encoding to xml via XTemplate, eg:
		/// &amp;lt;tpl for=&quot;.&quot;&gt;&amp;lt;{name}&gt;{value}&amp;lt;/{name}&amp;lt;/tpl&gt; 
		/// eg, non-phantom:
		/// {id: 1, first: &apos;foo&apos;, last: &apos;bar&apos;} --&gt; [{name: &apos;id&apos;, value: 1}, {name: &apos;first&apos;, value: &apos;foo&apos;}, {name: &apos;last&apos;, value: &apos;bar&apos;}] 
		/// {@link Ext.data.Record#phantom Phantom} records will have had their idProperty omitted in {@link #toHash} if determined to be auto-generated.
		/// Non AUTOINCREMENT pks should have been protected.
		/// </summary>
		/// <htmlSummary>
		/// Converts a {@link Ext.data.DataWriter#toHash Hashed} {@link Ext.data.Record} to fields-array array suitable
		/// for encoding to xml via XTemplate, eg:
		/// &lt;code&gt;&lt;pre&gt;&amp;lt;tpl for=&quot;.&quot;&gt;&amp;lt;{name}&gt;{value}&amp;lt;/{name}&amp;lt;/tpl&gt;&lt;/pre&gt;&lt;/code&gt;
		/// eg, &lt;b&gt;non-phantom&lt;/b&gt;:
		/// &lt;code&gt;&lt;pre&gt;{id: 1, first: &apos;foo&apos;, last: &apos;bar&apos;} --&gt; [{name: &apos;id&apos;, value: 1}, {name: &apos;first&apos;, value: &apos;foo&apos;}, {name: &apos;last&apos;, value: &apos;bar&apos;}]&lt;/pre&gt;&lt;/code&gt;
		/// {@link Ext.data.Record#phantom Phantom} records will have had their idProperty omitted in {@link #toHash} if determined to be auto-generated.
		/// Non AUTOINCREMENT pks should have been protected.
		/// </htmlSummary>
		/// <definedin>src\data\DataWriter.js</definedin>
		/// <param name="data">Hashed by Ext.data.DataWriter#toHash</param>
		/// <returns>Array of attribute-objects.</returns>
		[ScriptName("toArray")]
		public object ToArray(object data)
		{
			throw new System.Exception("Imported - not implemented");
		}
		
		/// <summary>
		/// Compiles a Store recordset into a data-format defined by an extension such as {@link Ext.data.JsonWriter} or {@link Ext.data.XmlWriter} in preparation for a {@link Ext.data.Api#actions server-write action}. The first two params are similar similar in nature to {@link Ext#apply},
		/// Where the first parameter is the receiver of paramaters and the second, baseParams, the source.
		/// </summary>
		/// <htmlSummary>
		/// Compiles a Store recordset into a data-format defined by an extension such as {@link Ext.data.JsonWriter} or {@link Ext.data.XmlWriter} in preparation for a {@link Ext.data.Api#actions server-write action}. The first two params are similar similar in nature to {@link Ext#apply},
		/// Where the first parameter is the &lt;i&gt;receiver&lt;/i&gt; of paramaters and the second, baseParams, &lt;i&gt;the source&lt;/i&gt;.
		/// </htmlSummary>
		/// <definedin>src\data\DataWriter.js</definedin>
		/// <param name="params">The request-params receiver.</param>
		/// <param name="baseParams">as defined by {@link Ext.data.Store#baseParams}. The baseParms must be encoded by the extending class, eg: {@link Ext.data.JsonWriter}, {@link Ext.data.XmlWriter}.</param>
		/// <param name="action">[{@link Ext.data.Api#actions create|update|destroy}]</param>
		/// <param name="rs">The recordset to write, the subject(s) of the write action.</param>
		[ScriptName("apply")]
		public void Apply(object @params, object baseParams, string action, ext.data.RecordClass rs)
		{
			throw new System.Exception("Imported - not implemented");
		}
		
		/// <summary>
		/// Compiles a Store recordset into a data-format defined by an extension such as {@link Ext.data.JsonWriter} or {@link Ext.data.XmlWriter} in preparation for a {@link Ext.data.Api#actions server-write action}. The first two params are similar similar in nature to {@link Ext#apply},
		/// Where the first parameter is the receiver of paramaters and the second, baseParams, the source.
		/// </summary>
		/// <htmlSummary>
		/// Compiles a Store recordset into a data-format defined by an extension such as {@link Ext.data.JsonWriter} or {@link Ext.data.XmlWriter} in preparation for a {@link Ext.data.Api#actions server-write action}. The first two params are similar similar in nature to {@link Ext#apply},
		/// Where the first parameter is the &lt;i&gt;receiver&lt;/i&gt; of paramaters and the second, baseParams, &lt;i&gt;the source&lt;/i&gt;.
		/// </htmlSummary>
		/// <definedin>src\data\DataWriter.js</definedin>
		/// <param name="params">The request-params receiver.</param>
		/// <param name="baseParams">as defined by {@link Ext.data.Store#baseParams}. The baseParms must be encoded by the extending class, eg: {@link Ext.data.JsonWriter}, {@link Ext.data.XmlWriter}.</param>
		/// <param name="action">[{@link Ext.data.Api#actions create|update|destroy}]</param>
		/// <param name="rs">The recordset to write, the subject(s) of the write action.</param>
		[ScriptName("apply")]
		public void Apply(object @params, object baseParams, string action, ext.data.RecordClass[] rs)
		{
			throw new System.Exception("Imported - not implemented");
		}
		#endregion
	}
}
